/**
 * Created by Administrator on 2018/6/20.
 */
$CertusJsonAjax.ajax("queryBidProcessTrace",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.processs = res.data;
})
$$scope.getsssbbb = function(bb){
    if(bb == "starting"){
        return "正在进行中";
    }else if(bb == "denied"){
        return "否决";
    }else if(bb == "sentback"){
        return "被退";
    }else if(bb == "others"){
        return "关闭";
    }else if(bb == "completed"){
        return "完成";    }else if(bb == "terminated"){        return "终结";    }    else if(bb == "cancelled"){        return "通过";}
    return "待办";
}
$CertusJsonAjax.ajax('bidBaseInfo', {
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
}, function (res) {
    $$scope.classfictionselect = [
        {name: '内部保密', value: "0"},
        {name: '内部公开', value: "1"},
        {name: '完全公开', value: "2"},
        {name: '请选择', value: "xxxx"}
    ];

    $$scope.rangeSelect = [
        {name: '请选择', value: "xxxx"},
        {name: '公司内部', value: "0"},
        {name: '公开信息', value: "1"}
    ]

    $$scope.permissionSelect = [
        {name: '请选择', value: "xxxx"},
        {name: '总经理', value: "0"},
        {name: '总监', value: "1"},
        {name: '本部门', value: "2"}
    ]

    var picker2 = $('#datetime').datetimepicker({
        format: 'YYYY-MM-DD',
        locale: moment.locale('zh-cn')
    }).on('dp.change', function (e) {
        var result = new moment(e.date).format('YYYY-MM-DD');
        if(result && !angular.isUndefined(result)){
            $$scope.file.validity= result;
            $$scope.$apply();
        }
    })

    $$scope.bid = res.data;
    $$scope.bid.processInstanceId =  $CertusJsonAjax.getProInstanceId();
    $$scope.bid.stepInstanceId =  $CertusJsonAjax.getStepInstanceId();
})


$$scope.attachmentDown = function(){
    $$scope.bid.pathFrom = "selbidB";
    $CertusJsonAjax.ajax('attachRelated',$$scope.bid,function(res){
        if(res.data == "success"){
            $CertusFormAjax.download("attachmentDown","processInstanceId="+$$scope.bid.processInstanceId+"&pathFrom="+"selbidB");
        }else{
            layer.msg("并未上传相关文件");
        }
    })
}




$$scope.submitBid = function(){
    $$scope.bid.fileDescriptor = $$scope.bid.descriptor;
    $$scope.bid.fileCategories = "投标流程";
    $$scope.bid.fileClass = "技术方案";
    $CertusJsonAjax.ajax("filingInstructionAlter",$$scope.bid,function(res){
        $$scope.bid.nameOfPage = "技术方案审核";
        if(res.data == "success"){
            history.back();
        }
    })
}

$$scope.bidDenied = function(){
    $CertusJsonAjax.ajax("bidDenied",$$scope.bid,function(res){
        history.back();
    })
}

$$scope.bidVeto = function(){
    $CertusJsonAjax.ajax("bidVeto",$$scope.bid,function(res){
        if(res.data == "success"){
            history.back();
        }

    })
}